package com.threeti.mecool.mobile;

import com.threeti.mecool.framework.util.CommonWebUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * Command生成器
 *
 * Command的自动生成必须依赖于web.xml中的listener配置
 * @see org.springframework.web.context.request.RequestContextListener
 *
 * @author Jay Meng
 */
public abstract class Commander {

  public static String command() {
    HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
    String command = CommonWebUtils.getOriginatingDecodedURL(request, true, true);
    return command.replaceAll("/", "_");
  }

//->已废弃
//public static final String CMD_AUTH_LOGIN = "auth_login";
//public static final String CMD_USER_CHANGEPASS = "user_changepassword";
//
//public static final String CMD_USER_COMMUNICATIONS = "user_communications";
//public static final String CMD_USER_STORE_COMMUNICATION = "user_storecommunication";
//public static final String CMD_USER_PROJECT_WITH_STORES = "user_projectwithstores";
//public static final String CMD_USER_MEMOS = "user_memos";
//public static final String CMD_USER_CHANNELS_ASSOCIATED_WITH_PROJECTS = "user_channelsassociatedwithprojects";
//public static final String CMD_USER_STORE_MEMO = "user_storememo";
//public static final String CMD_USER_REMOVE_MEMO = "user_removememo";

//->merged into 'user_projectwithstores'
//public static final String CMD_USER_OWNPROJECTS = "user_ownprojects";
//public static final String CMD_USER_OWNPROJSTORES = "user_ownprojstores";
//<-
//<-
}
